#! /usr/bin/env python
import waflib.Options
from waf_dynamo import platform_glfw_version

def configure(conf):
    pass

def build(bld):
    defines = []

    if platform_glfw_version(bld.env.PLATFORM) == 3:
        defines = ['DM_INPUT_USE_GLFW3']

    lib = bld.stlib(features        = 'cxx c ddf',
                    includes        = '../proto .',
                    defines         = defines,
                    target          = 'input',
                    source          = bld.path.ant_glob('input.cpp') + bld.path.parent.ant_glob('proto/input/*'),
                    proto_gen_py    = True,
                    protoc_includes = '../proto')

    bld.install_files('${PREFIX}/include/input', 'input.h')
    bld.install_files('${PREFIX}/share/proto', '../proto/input/input_ddf.proto')

    if not waflib.Options.options.skip_build_tests:
        bld.recurse('test')
